<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<meta http-equiv="X-UA-Compatible" content="chrome=1">	
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title>$VERSION$</title>
	<link rel="icon" href="/favicon.ico" type="image/png" />
  <link rel="SHORTCUT ICON" href="/favicon.ico" type="image/png" />

<!-- YUI -->
<link rel="stylesheet" type="text/css" href="lib/yui/reset-fonts-grids/reset-fonts-grids.css" />
<link rel="stylesheet" type="text/css" href="lib/yui/assets/skins/sam/skin.css" />

<!-- YUI-accordion CSS -->
<link rel="stylesheet" type="text/css" href="/lib/accordionview/assets/skins/sam/accordionview.css" />

<!-- InputEx CSS -->
<link type='text/css' rel='stylesheet' href='lib/inputex/css/inputEx.css' />

<!-- WireIt CSS -->
<link rel="stylesheet" type="text/css" href="css/WireIt.css" />
<link rel="stylesheet" type="text/css" href="css/WireItEditor.css" />

<style>
div.WireIt-Container {
	width: 200px; /* Prevent the modules from scratching on the right */
	/*height: 100px;*/
}

#toolbar #WiringEditor-runButton.yui-button {
	margin-left: 15px;
	/*font-size: 12px;*/
}

#WiringEditor-runButton button {
	background: transparent url(images/icons/bullet_go.png) center center no-repeat; /*no-repeat scroll 10% 50%;*/
	font-weight: bold;
}

#toolbar #WiringEditor-stopButton.yui-button {
	/*font-size: 12px;*/
}


#WiringEditor-stopButton button {
 background:transparent url(../images/icons/stop16x16.png) center center no-repeat; /*no-repeat scroll 10% 50%;*/
 font-weight: bold;
}

#toolbar #WiringEditor-connectButton.yui-button {
	/*font-size: 12px;*/
}

#WiringEditor-connectButton button {
 background:transparent url(../images/icons/connect.png) center center no-repeat; /*no-repeat scroll 10% 50%;*/
 font-weight: bold;
}

#toolbar #WiringEditor-collapseButton.yui-button {
	margin-left: 15px;
	/*font-size: 12px;*/
}

#WiringEditor-collapseButton button {
 background:transparent url(../images/collapse.png) center center no-repeat;
}

#toolbar #WiringEditor-expandButton.yui-button {
	/*font-size: 12px;*/
}

#WiringEditor-expandButton button {
 background:transparent url(../images/expand.png) center center no-repeat;
}

#toolbar #WiringEditor-debugButton.yui-button {
	margin-left: 15px;
	/*font-size: 12px;*/
}

#WiringEditor-debugButton button {
 background:transparent url(../images/icons/bug.png)  center center no-repeat; /*no-repeat scroll 10% 50%;*/
}

div.WireIt-Container div.inputEx-Group div.inputEx-label {
	width: auto;
}

div.inputEx-TypeField-PropertiesPanel {
	z-index: 7;
}



div.WireIt-Container.WiringEditor-module-comment div.body {
	background-color: #EEEE66;
}


div.WireIt-Container.WiringEditor-module-comment div.body textarea {
	background-color: transparent;
	font-weight: bold;
	border: 0;
}


div.ComposedModule {
	background-color: #DDDDAA;
}

</style>


<!-- YUI -->
<script type="text/javascript" src="lib/yui/utilities/utilities.js"></script>
<script type="text/javascript" src="lib/yui/resize/resize-min.js"></script>
<script type="text/javascript" src="lib/yui/layout/layout-min.js"></script>
<script type="text/javascript" src="lib/yui/container/container-min.js"></script>
<script type="text/javascript" src="lib/yui/json/json-min.js"></script>
<script type="text/javascript" src="lib/yui/json/json-min-new.js"></script>
<script type="text/javascript" src="lib/yui/button/button-min.js"></script>
<script type="text/javascript" src="/lib/yui/tabview/tabview-min.js"></script>

<!-- YUI-RPC -->
<script type="text/javascript" src="lib/yui-rpc.js"></script>

<!-- InputEx with wirable options (WirableField-beta) -->
<script src="lib/inputex/js/inputex.js"  type='text/javascript'></script>
<script src="lib/inputex/js/Field.js"  type='text/javascript'></script>
<script type="text/javascript" src="js/util/inputex/WirableField-beta.js"></script>
<script src="lib/inputex/js/Group.js"  type='text/javascript'></script>
<script src="lib/inputex/js/Visus.js"  type='text/javascript'></script>

<!-- Form fields-->
<script src="lib/inputex/js/fields/StringField.js"  type='text/javascript'></script>
<script src="lib/inputex/js/fields/Textarea.js"  type='text/javascript'></script>
<script type="text/javascript" src="js/IntegerField.js"></script>
<script type="text/javascript" src="js/NumberField.js"></script>
<script src="lib/inputex/js/fields/UrlField.js"  type='text/javascript'></script>
<script src="lib/inputex/js/fields/CheckBox.js"  type='text/javascript'></script>
<script src="lib/inputex/js/fields/SelectField.js"  type='text/javascript'></script>
<script src="lib/inputex/js/fields/MultiSelectField.js"  type='text/javascript'></script>
<script src="lib/inputex/js/fields/TypeField.js"  type='text/javascript'></script>
<script src="lib/inputex/js/widgets/ddlist.js"  type='text/javascript'></script>
<script type="text/javascript" src="js/FileField.js"></script>
<script type="text/javascript" src="js/ArrayField.js"></script>
<script type="text/javascript" src="js/MUrlField.js"></script>

<!-- YUI-Accordion -->
<script src="lib/accordionview/accordionview-min.js"  type='text/javascript'></script>

<!-- WireIt -->
<!--[if IE]><script type="text/javascript" src="lib/excanvas.js"></script><![endif]-->
<script type="text/javascript" src="js/WireIt.js"></script>
<script type="text/javascript" src="js/CanvasElement.js"></script>
<script type="text/javascript" src="js/Wire.js"></script>
<script type="text/javascript" src="js/Terminal.js"></script>
<script type="text/javascript" src="js/util/DD.js"></script>
<script type="text/javascript" src="js/util/DDResize.js"></script>
<script type="text/javascript" src="js/Container.js"></script>
<script type="text/javascript" src="js/Layer.js"></script>
<script type="text/javascript" src="js/util/inputex/FormContainer-beta.js"></script>
<script type="text/javascript" src="js/LayerMap.js"></script>
<script type="text/javascript" src="js/WiringEditor.js"></script>
<script type="text/javascript" src="js/ImageContainer.js"></script>
<script type="text/javascript" src="js/InOutContainer.js"></script>
<script type="text/javascript" src="js/adapters/json-rpc.js"></script>

<!-- Igor Lazarev -->
<script type="text/javascript" src="js/WebUIContainer.js"></script>
<script type="text/javascript" src="js/WebUIFormContainer.js"></script>
<script type="text/javascript" src="js/WebUIInputContainer.js"></script>
<script type="text/javascript" src="js/WebUIOutputContainer.js"></script>
<script type="text/javascript" src="js/WebUILayer.js"></script>
<script type="text/javascript" src="js/WebUIWiringEditor.js"></script>
<script type="text/javascript" src="js/WebUITerminal.js"></script>
<script type="text/javascript" src="js/WebUITools.js"></script>
<script type="text/javascript" src="js/WebUITerminalInput.js"></script>
<script type="text/javascript" src="js/WebUITerminalOutput.js"></script>
<script type="text/javascript" src="js/WebUITypeField.js"></script>
<script type="text/javascript" src="js/ScriptContainer.js"></script>
<script type="text/javascript" src="js/JavascriptContainer.js"></script>
<script type="text/javascript" src="js/PythonContainer.js"></script>

<!-- prototype library handles GET and POST requests -->
<script type="text/javascript" src="js/prototype.js"></script>

<!-- upload -->
<script type="text/javascript" src="js/Upload.js"></script> 

<!-- lightloader -->
<link href="lightloader/upload.css" type="text/css" rel="stylesheet"/>

<script type="text/javascript" src="lightloader/json_c.js"></script>
<script type="text/javascript" src="lightloader/upload_form.js"></script>
<script type="text/javascript" src="lightloader/sr_c.js"></script>

<!--[if IE]>

<body>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"> </script>

<script language="javascript">document.title = "The new title goes here.";</script>

<div id="placeholder"></div>

<script>
 CFInstall.check({
    node: "placeholder",
    mode: "popup",
    onmissing: window.open('frame.html','_self')
  });

</script>
</body>

<![endif]-->
<script>
var agt=navigator.userAgent.toLowerCase();
if (agt.indexOf("opera") != -1){
	window.open('opera.html','_self');
}
</script>
<!-- Language definition script -->
<script type="text/javascript" src="workflow.js"></script> 

<script>

// InputEx needs a correct path to this image
inputEx.spacerUrl = "/inputex/trunk/images/space.gif";

YAHOO.util.Event.onDOMReady( function() {
	//AuthAPI
	new Ajax.Request (location.href+'auth/', {
				method:'get',
				requestHeaders: {Accept: 'application/json'},
			
				onSuccess: function(transport){
				var response = YAHOO.lang.JSON.parse(transport.responseText) || "no response text";
				//alert("response: " + transport.responseText);								
				if(response.secure==true){
					if(typeof(response.user)!="undefined"){
						var userIdentity=YAHOO.lang.JSON.stringify(response.user).replace(new RegExp('["]*','g'),'');						
						//var userIdentityTruncated = userIdentity.replace(new RegExp('http://','g'),'').replace(new RegExp('https://','g'),'').replace(new RegExp('www','g'),'').truncate();
                        this.guestMode = response.guest;
						document.getElementById("topright").innerHTML = (guestMode?'<span style="font-weight: bold; color: white; background-color: orange;">GUEST</span>':'<span style="font-weight: bold; color: white; background-color: green;">USER</span>') + ' ' + userIdentity + ' <a href="'+location.href+'logout?redirect=/">Log out</a>';
						document.getElementById("topright").style.display="block";

                        startEditor();
					}
					else{
						window.location=location.href+'login/?redirect=/';
					}
				} else if(response.secure==false){
                    startEditor();
				}
					
				}.bind(this),

				onFailure: function(transport){ 
					var url = location.href+'auth/'; 
					var response = transport.responseText || "no response text";
					  if (transport.status==404) {	
						//do nothing
					   } else if (transport.status==400) {
					   alert("mistake in url "+url+"\n"+response);

					   } else {
						//do nothing
 						}
					}.bind(this)
	});


function startEditor() {
    //unhide body
    document.getElementById("body").style.visibility = "visible";

	//initialize the editor	
	var editor = new WireIt.WebUIWiringEditor(Workflow.language, this.guestMode); 
	editor.leftAccordionView.openPanel(0);
	editor.accordionView.openPanel(2);	
	editor.accordionView.openPanel(3);

	if (screen.width<=1024){//for small screens
		//hide the right accordion		
		simulateEvent("click",document.getElementById("right").parentNode.parentNode.getElementsByClassName("collapse")[0]);
	}
}
	
});



</script>   

</head>

<body class="yui-skin-sam" id="body" style="visibility: hidden" onLoad="document.title = document.title + ' @ ' + window.location.hostname;">

	<div id="top">
		<div class="logo">Workflow Editor</a></div>
		<div id="toolbar"></div>
		<div class="topright" id ="topright"></div>
	</div>


	<div id="left">
		<ul id = "leftAccordionView">
			<li>
				<h2>General</h2>
				<div>
					<div id = "generalDiv"></div></br>
				</div>
			</li>
			<li>
				<h2>Antiprism</h2>
				<div style='position: relative;'>
					<div id="antiprismDiv"></div>
				</div>
			</li>
			<li>
				<h2>LP Solvers</h2>
				<div style='position: relative;'>
					<div id="LPDiv"></div>
				</div>
			</li>
			<li>
				<h2>Neos</h2>
				<div style='position: relative;'>
					<div id="NeosDiv"></div>
				</div>
			</li>
			<li>
				<h2>Misc</h2>
				<div style='position: relative;'>
					<div id="miscDiv"></div>
				</div>
			</li>
			<li>
				<h2>Composed</h2>
				<div style='position: relative;'>
					<div id="composedDiv"></div>
				</div>
			</li>
		</ul>
	</div>
	
	<div id="right">
	  <ul id="accordionView">
		<li>
			<h2>Properties</h2>
			<div>
				<div id="IDForm"></div></br>
				<div id ="instanceForm"></div></br>				
				<div id="propertiesForm"></div>
			</div>
		</li>
		<li>
			<h2>Minimap</h2>
			<div style='position: relative;'>
				<div id="layerMap"></div>
			</div>
		</li>
		<li>
			<h2>Task Properties</h2>
			<div style='position: relative;'>
			<div id="taskPropertiesForm"></div>
			</div>
		</li>

		<li>
			<h2>Info</h2>
			<div>
				<div style="padding: 10px;">
					<p>This is workflow editor for <a href = "http://code.google.com/p/websolve/" target=”_new”>WebSolve</a> platform. It is based on the <a href ="http://javascript.neyric.com/wireit/" target=”_new”>WireIt library</a></p>
					<br />
					<p><b>Drag and drop modules from the Module list</b> on the left to the working layer in the middle.</p>
					<br />
					<p><b>Tip:</b> please remember to give significant names to inputs and outputs. Then it will be easier to use your workflows as services afterwards.</p>
					<br />
					<span><a href="mailto:lazarev.igor@gmail.com">Igor Lazarev</a></span>
				</div>
			</div>
		</li>
		
	  </ul>
	</div>

	<div id="center">
	</div>
	
	
	<div id="helpPanel">
	    <div class="hd">Welcome to the Workflow Editor demonstration</div>
	    <div class="bd" style="text-align: left;">
					
					<p>This is workflow editor for <a href = "http://code.google.com/p/websolve/" target=”_new”>WebSolve</a> platform. It is based on the <a href ="http://javascript.neyric.com/wireit/" target=”_new”>WireIt library</a></p>
					<br />
					<p><b>Drag and drop modules from the Module list</b> on the left to the working layer in the middle.</p>
					<br />
					<p><b>Tip:</b> please remember to give significant names to inputs and outputs. Then it will be easier to use your workflows as services afterwards.</p>
					<br />
					<span><a href="mailto:lazarev.igor@gmail.com">Igor Lazarev</a></span>
	    </div>
	</div>

</body>
</html>
